import request from '@/axios/request';

enum api {
    ADD_RECIPIENT = '/reci/add_recipients',
    QUERY_RECIPIENTS = '/reci/query_recipients?',
    ADD_ONE_RECIPIENT= '/reci/add_oneRecipient?isEdit=',
    DEL_RECIPIENT = '/reci/del_oneRecipient?country_code='
}

// 添加收件人
export const addRecipient = () => {
    return request.post(api.ADD_RECIPIENT);
}

// 查询收件人
export const queryRecipients = (country_code:string,country_name:string,page:number,page_size:number) => {
    return request.get(api.QUERY_RECIPIENTS+`country_code=${country_code}&country_name=${country_name}&page=${page}&page_size=${page_size}`);
}

// 添加或修改单个收件人
export const addOneRecipient = (data: any,isEdit:boolean) => {
    return request.post(api.ADD_ONE_RECIPIENT+isEdit, data);
}

// 删除收件人
export const deleteRecipient = (country_code:string,) => {
    return request.delete(api.DEL_RECIPIENT + country_code);
}